package com.chen.q2.xml;

import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.w3c.dom.Element;

public class StudentBeanHandler extends AbstractSingleBeanDefinitionParser {
    @Override
    protected Class<?> getBeanClass(Element element) {
        return Student.class;
    }

    @Override
    protected void doParse(Element element,  BeanDefinitionBuilder builder) {
        int id = Integer.valueOf(element.getAttribute("id")) ;
        String name = element.getAttribute("name");
        builder.addPropertyValue("id",id);
        builder.addPropertyValue("name",name);
    }
}
